<template>
  <div class="app-container">
    <el-tabs v-model="activeName">
      <el-tab-pane label="花纸派工" name="first">
        <el-row class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" @click="handleAddPaperFlower">新增</el-button>
          </el-col>
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
        <el-tooltip placement="top">
        <div slot="content">点击任意一行列即可跳转查看记录</div>
        
          <el-table :data="paperFlowerPurchaseList" v-loading="loadingPaperFlower" :row-class-name="rowClassName" @row-click="showTab">
             <el-table-column type="selection" width="55" />
             <el-table-column align="center" label="基本信息">
              <el-table-column align="center" label="合同号" prop="purchaseContractNumber"/>
              <el-table-column align="center" label="生成任务单号" prop="purchaseProductionTaskNumber"/>
              <el-table-column align="center" label="产品代号" prop="purchaseProductCode"/>
              <el-table-column align="center" label="模具编号" prop="purchaseMoldNumber"/>
              <el-table-column align="center" label="花色" prop="purchaseColor"/>
             </el-table-column>
              <el-table-column align="center" label="指定派工">
                <el-table-column align="center" label="部门" prop="purchaseDepartment"/>
                <el-table-column align="center" label="负责人" prop="purchasePrincipal"/>
                <el-table-column align="center" label="生产数量" prop="purchaseQuantity"/>
              </el-table-column>
             <el-table-column align="center" label="操作" fixed="right" width="150">
               <template slot-scope="scope">
                 <el-button type="text" @click="handleUpdatePaperFlower(scope.row)">修改</el-button>
                 <el-button type="text" @click="handleDeletePaperFlower(scope.row)">删除</el-button>
               </template>
             </el-table-column>
          </el-table>
        </el-tooltip>
      
      <pagination :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"
      :total="this.paperFlowerPurchaseList.length" />
      
      <el-tabs v-model="activeName1">
        <el-tab-pane name="first" v-show="showProductionTask">
         <h2 align="center">花纸派工明细信息</h2>
         <el-row class="mb8">
           <el-col :span="1.5">
            <el-button type="primary" @click="handleAddPaperFlowerDetail">新增</el-button>
           </el-col>
           
         </el-row>
        <el-table :data="paperProductionTaskList" v-loading="loadingPaperFlowerDetail">
          <el-table-column align="center" label="计划生产开始时间" prop="paperStartDate"/>
          <el-table-column align="center" label="班次" prop="paperClass"/>
          <el-table-column align="center" label="每班人数" prop="paperPersonNumber"/>
          <el-table-column align="center" label="计划完成工作日" prop="paperWorkDays"/>
          <el-table-column align="center" label="操作" fixed="right" width="150">
            <template slot-scope="scope">
              <el-button type="text" @click="handleUpdatepaperFlowerDetail(scope.row)">修改</el-button>
              <el-button type="text" @click="handleDeletepaperFlowerDetail(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      </el-tabs>
      </el-tab-pane>
      
      <el-tab-pane label="成型派工" name="second">
        <el-row class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" @click="handleAddModel">新增</el-button>
          </el-col>
        </el-row>
        <el-tooltip placement="top">
        <div slot="content">点击任意一行列即可跳转查看记录</div>
          <el-table :data="modelPurchaseList" v-loading="loadingModel" :row-class-name="rowClassNameOne" @row-click="showTab">
             <el-table-column type="selection" width="55" />
             <el-table-column align="center" label="基本信息">
              <el-table-column align="center" label="合同号" prop="modelContractNumber"/>
              <el-table-column align="center" label="生成任务单号" prop="modelProductionTaskNumber"/>
              <el-table-column align="center" label="产品代号" prop="modelProductCode"/>
              <el-table-column align="center" label="模具编号" prop="modelMoldNumber"/>
              <el-table-column align="center" label="花色" prop="modelColor"/>
             </el-table-column>
              <el-table-column align="center" label="指定派工">
                <el-table-column align="center" label="部门" prop="modelDepartment"/>
                <el-table-column align="center" label="负责人" prop="modelPrincipal"/>
                <el-table-column align="center" label="生产数量" prop="modelQuantity"/>
              </el-table-column>
             <el-table-column align="center" fixed="right" label="操作" width="150">
               <template slot-scope="scope">
                 <el-button type="text" @click="handleUpdateModel(scope.row)">修改</el-button>
                 <el-button type="text" @click="handleDeleteModel(scope.row)">删除</el-button>
               </template>
             </el-table-column>
          </el-table>
        </el-tooltip>
      
      <pagination :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"
      :total="this.modelPurchaseList.length" />
      
      <el-tabs v-model="activeName1">
        <el-tab-pane name="first" v-show="showModel">
         <h2 align="center">成型派工明细信息</h2>
          <el-row class="mb8">
            <el-col :span="1.5">
              <el-button type="primary" @click="handleAddModelDetail">新增</el-button>
            </el-col>
          </el-row>
        <el-table :data="modelProductionTaskList" v-loading="loadingModelDetail" >
          <el-table-column align="center" label="计划生产开始时间" prop="modelStartDate"/>
          <el-table-column align="center" label="班次" prop="modelClass"/>
          <el-table-column align="center" label="每班人数" prop="modelPersonNumber"/>
          <el-table-column align="center" label="计划完成工作日" prop="modelWorkDays"/>
          <el-table-column align="center" label="操作" fixed="right" width="150">
            <template slot-scope="scope">
              <el-button type="text" @click="handleUpdateModelDetail(scope.row)">修改</el-button>
              <el-button type="text" @click="handleDeleteModelDetail(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      </el-tabs>
      </el-tab-pane>
      
      <el-tab-pane label="研磨派工" name="third">
        <el-row class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" @click="handleAddGroundMolding">新增</el-button>
          </el-col>
        </el-row>
        <el-tooltip placement="top">
        <div slot="content">点击任意一行列，即可在下方查看明细信息记录</div>
          <el-table :data="groundMoldingPurchaseList" v-loading="loadingGroundMold" :row-class-name="rowClassNameSecond" @row-click="showTab">
             <el-table-column type="selection" width="55" />
             <el-table-column align="center" label="基本信息">
              <el-table-column align="center" label="合同号" prop="groundMoldingContractNumber"/>
              <el-table-column align="center" label="生成任务单号" prop="groundMoldingProductionTaskNumber"/>
              <el-table-column align="center" label="产品代号" prop="groundMoldingProductCode"/>
              <el-table-column align="center" label="模具编号" prop="groundMoldingMoldNumber"/>
              <el-table-column align="center" label="花色" prop="groundMoldingColor"/>
             </el-table-column>
              <el-table-column align="center" label="指定派工">
                <el-table-column align="center" label="部门" prop="groundMoldingDepartment"/>
                <el-table-column align="center" label="负责人" prop="groundMoldingPrincipal"/>
                <el-table-column align="center" label="生产数量" prop="groundMoldingQuantity"/>
              </el-table-column>
             <el-table-column align="center" fixed="right" label="操作" width="150">
               <template slot-scope="scope">
                 <el-button type="text" @click="handleUpdateGroundMolding(scope.row)">修改</el-button>
                 <el-button type="text" @click="handleDeleteGroundMolding(scope.row)">删除</el-button>
               </template>
             </el-table-column>
          </el-table>
        </el-tooltip>
      
      <pagination :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"
      :total="this.groundMoldingPurchaseList.length" />
      
      <el-tabs v-model="activeName1">
        <el-tab-pane name="first" v-show="showGroundMold">
         <h2 align="center">研磨派工明细信息</h2>
         <el-row class="mb8">
            <el-col :span="1.5">
              <el-button type="primary" @click="handleAddGroundMoldingDetail">新增</el-button>
            </el-col>
          </el-row>
        <el-table :data="groundMoldingProductionTaskList" v-loading="loadingGroundMoldingDetail">
          <el-table-column align="center" label="计划生产开始时间" prop="groundMoldingStartDate"/>
          <el-table-column align="center" label="班次" prop="groundMoldingClass"/>
          <el-table-column align="center" label="每班人数" prop="groundMoldingPersonNumber"/>
          <el-table-column align="center" label="计划完成工作日" prop="groundMoldingWorkDays"/>
          <el-table-column label="操作" fixed="right" width="150">
            <template slot-scope="scope">
              <el-button type="text" @click="handleUpdateGroundMoldDetail(scope.row)">修改</el-button>
              <el-button type="text" @click="handleDeleteGroundMoldDetail(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      </el-tabs>
      </el-tab-pane>
    </el-tabs>
    
    <!-- 花纸派工弹框 -->
     <el-dialog :title="titlePaperFlower" :visible.sync="openPaperFlower" width="500px" append-to-body>
       <el-form :model="paperFlowerForm" ref="paperFlowerForm" :rules="paperFlowerFormRules" label-width="100px">
        <el-form-item label="合同号" prop="purchaseContractNumber">
          <el-input v-model="paperFlowerForm.purchaseContractNumber" placeholder="请输入合同号"></el-input>
        </el-form-item>
        <el-form-item label="生成任务单号" prop="purchaseProductionTaskNumber">
          <el-input v-model="paperFlowerForm.purchaseProductionTaskNumber" placeholder="请输入生成任务单号"></el-input>
        </el-form-item>
        <el-form-item label="产品代号" prop="purchaseProductCode">
          <el-input v-model="paperFlowerForm.purchaseProductCode" placeholder="请输入产品代号"></el-input>
        </el-form-item>
        <el-form-item label="模具编号" prop="purchaseMoldNumber">
          <el-input v-model="paperFlowerForm.purchaseMoldNumber" placeholder="请输入模具编号"></el-input>
        </el-form-item>
        <el-form-item label="花色" prop="purchaseColor">
          <el-input v-model="paperFlowerForm.purchaseColor" placeholder="请输入花色"></el-input>
        </el-form-item>
          <el-form-item label="部门" prop="purchaseDepartment">
            <el-input v-model="paperFlowerForm.purchaseDepartment" placeholder="请输入部门"></el-input>
          </el-form-item>
          <el-form-item label="负责人" prop="purchasePrincipal">
            <el-input v-model="paperFlowerForm.purchasePrincipal" placeholder="请输入负责人"></el-input>
          </el-form-item>
          <el-form-item label="生产数量" prop="purchaseQuantity">
            <el-input v-model="paperFlowerForm.purchaseQuantity" placeholder="请输入生产数量"></el-input>
          </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="openPaperFlowerClose">取 消</el-button>
        <el-button type="primary" @click="handleSubmitPaperFlower">确 定</el-button>
      </div>
     </el-dialog>
    
    <!-- 花纸派工明细弹框 -->
     <el-dialog :title="titlePaper" :visible.sync="openPaper" width="500px" append-to-body>
      <el-form :model="paperForm" ref="paperForm" :rules="paperFormRules" label-width="100px">
        <el-form-item label="计划生产开始时间" prop="paperStartDate">
          <el-date-picker type="date" placeholder="选择日期" v-model="paperForm.paperStartDate" ></el-date-picker>
        </el-form-item>
        <el-form-item label="班次" prop="paperClass">
          <el-select v-model="paperForm.paperClass" placeholder="请选择班次">
            <el-option label="早班" value="早班"></el-option>
            <el-option label="中班" value="中班"></el-option>
            <el-option label="晚班" value="晚班"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="每班人数" prop="paperPersonNumber">
          <el-input v-model="paperForm.paperPersonNumber" placeholder="请输入每班人数"></el-input>
        </el-form-item>
        <el-form-item label="计划完成工作日" prop="paperWorkDays">
          <el-date-picker type="date" placeholder="选择日期" v-model="paperForm.paperWorkDays"></el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="openPaperClose">取 消</el-button>
        <el-button type="primary" @click="handleSubmitPaper">确 定</el-button>
      </div>
     </el-dialog>
     
     <!-- 成型派工弹框 -->
     <el-dialog :title="titleModel" :visible.sync="openModel" width="500px" append-to-body>
       <el-form :model="modelForm" ref="modelForm" :rules="modelFormRules" label-width="100px">
         <el-form-item label="合同号" prop="modelContractNumber">
           <el-input v-model="modelForm.modelContractNumber" placeholder="请输入合同号"></el-input>
         </el-form-item>
         <el-form-item label="生成任务单号" prop="modelProductionTaskNumber">
           <el-input v-model="modelForm.modelProductionTaskNumber" placeholder="请输入生成任务单号"></el-input>
         </el-form-item>
         <el-form-item label="产品代号" prop="modelProductCode">
           <el-input v-model="modelForm.modelProductCode" placeholder="请输入产品代号"></el-input>
         </el-form-item>
         <el-form-item label="模具编号" prop="modelMoldNumber">
           <el-input v-model="modelForm.modelMoldNumber" placeholder="请输入模具编号"></el-input>
         </el-form-item>
         <el-form-item label="花色" prop="modelColor">
           <el-input v-model="modelForm.modelColor" placeholder="请输入花色"></el-input>
         </el-form-item>
           <el-form-item label="部门" prop="modelDepartment">
             <el-input v-model="modelForm.modelDepartment" placeholder="请输入部门"></el-input>
           </el-form-item>
           <el-form-item label="负责人" prop="modelPrincipal">
             <el-input v-model="modelForm.modelPrincipal" placeholder="请输入负责人"></el-input>
           </el-form-item>
           <el-form-item label="生产数量" prop="modelQuantity">
             <el-input v-model="modelForm.modelQuantity" placeholder="请输入生产数量"></el-input>
           </el-form-item>
         
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="openModelClose">取 消</el-button>
         <el-button type="primary" @click="handleSubmitModel">确 定</el-button>
       </div>
     </el-dialog>
     
     <!-- 成型派工明细弹框 -->
     <el-dialog :title="titleModelDetail" :visible.sync="openModelDetail" width="500px" append-to-body>
      <el-form :model="modelDetailForm" ref="modelDetailForm" :rules="modelDetailFormRules" label-width="100px">
         <el-form-item label="计划生产开始时间" prop="modelStartDate">
           <el-date-picker type="date" placeholder="选择日期" v-model="modelDetailForm.modelStartDate" ></el-date-picker>
         </el-form-item>
         <el-form-item label="班次" prop="modelClass">
           <el-select v-model="modelDetailForm.modelClass" placeholder="请选择班次">
             <el-option label="早班" value="早班"></el-option>
             <el-option label="中班" value="中班"></el-option>
             <el-option label="晚班" value="晚班"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="每班人数" prop="modelPersonNumber">
           <el-input v-model="modelDetailForm.modelPersonNumber" placeholder="请输入每班人数"></el-input>
         </el-form-item>
         <el-form-item label="计划完成工作日" prop="modelWorkDays">
           <el-date-picker type="date" placeholder="选择日期" v-model="modelDetailForm.modelWorkDays"></el-date-picker>
         </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
         <el-button @click="openModelDetailClose">取 消</el-button>
         <el-button type="primary" @click="handleSubmitModelDetail">确 定</el-button>
      </div>
     </el-dialog>
     
     <!-- 研磨派工弹框 -->
      <el-dialog :title="titleGroundMolding" :visible.sync="openGroundMolding" width="500px" append-to-body>
       <el-form :model="groundMoldingForm" ref="groundMoldingForm" :rules="groundMoldingFormRules" label-width="100px">
         <el-form-item label="合同号" prop="groundMoldingContractNumber">
           <el-input v-model="groundMoldingForm.groundMoldingContractNumber" placeholder="请输入合同号"></el-input>
         </el-form-item>
         <el-form-item label="生成任务单号" prop="groundMoldingProductionTaskNumber">
           <el-input v-model="groundMoldingForm.groundMoldingProductionTaskNumber" placeholder="请输入生成任务单号"></el-input>
         </el-form-item>
         <el-form-item label="产品代号" prop="groundMoldingProductCode">
           <el-input v-model="groundMoldingForm.groundMoldingProductCode" placeholder="请输入产品代号"></el-input>
         </el-form-item>
         <el-form-item label="模具编号" prop="groundMoldingMoldNumber">
           <el-input v-model="groundMoldingForm.groundMoldingMoldNumber" placeholder="请输入模具编号"></el-input>
         </el-form-item>
         <el-form-item label="花色" prop="groundMoldingColor">
           <el-input v-model="groundMoldingForm.groundMoldingColor" placeholder="请输入花色"></el-input>
         </el-form-item>
           <el-form-item label="部门" prop="groundMoldingDepartment">
             <el-input v-model="groundMoldingForm.groundMoldingDepartment" placeholder="请输入部门"></el-input>
           </el-form-item>
           <el-form-item label="负责人" prop="groundMoldingPrincipal">
             <el-input v-model="groundMoldingForm.groundMoldingPrincipal" placeholder="请输入负责人"></el-input>
           </el-form-item>
           <el-form-item label="生产数量" prop="groundMoldingQuantity">
             <el-input v-model="groundMoldingForm.groundMoldingQuantity" placeholder="请输入生产数量"></el-input>
           </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="openGroundMoldingClose">取 消</el-button>
         <el-button type="primary" @click="handleSubmitGroundMolding">确 定</el-button>
       </div>
      </el-dialog>
      
      <!-- 研磨派工明细弹框 -->
      <el-dialog :title="titleGroundMoldingDetail" :visible.sync="openGroundMoldingDetail" width="500px" append-to-body>
         <el-form :model="groundMoldingDetailForm" ref="groundMoldingDetailForm" :rules="groundMoldingDetailFormRules" label-width="100px">
           <el-form-item label="计划生产开始时间" prop="groundMoldingStartDate">
             <el-date-picker type="date" placeholder="选择日期" v-model="groundMoldingDetailForm.groundMoldingStartDate" ></el-date-picker>
           </el-form-item>
           <el-form-item label="班次" prop="groundMoldingClass">
             <el-select v-model="groundMoldingDetailForm.groundMoldingClass" placeholder="请选择班次">
               <el-option label="早班" value="早班"></el-option>
               <el-option label="中班" value="中班"></el-option>
               <el-option label="晚班" value="晚班"></el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="每班人数" prop="groundMoldingPersonNumber">
             <el-input v-model="groundMoldingDetailForm.groundMoldingPersonNumber" placeholder="请输入每班人数"></el-input>
           </el-form-item>
           <el-form-item label="计划完成工作日" prop="groundMoldingWorkDays">
             <el-date-picker type="date" placeholder="选择日期" v-model="groundMoldingDetailForm.groundMoldingWorkDays"></el-date-picker>
           </el-form-item>
         </el-form>
         <div slot="footer" class="dialog-footer">
           <el-button @click="openGroundMoldingDetailClose">取 消</el-button>
           <el-button type="primary" @click="handleSubmitGroundMoldingDetail">确 定</el-button>
         </div>
      </el-dialog>
  </div>
</template>

<script>

export default {
  name: "ProductionTasks",
  data() {
    return {
      // 花纸派工弹框
      openPaperFlower: false,
      titlePaperFlower: "",
      paperFlowerForm: {},
      // 花纸派工明细弹框
      paperForm: {},
      openPaper: false,
      titlePaper: "",
      // 成型派工弹框
      openModel: false,
      titleModel: "",
      modelForm: {},
      // 成型派工明细弹框
      openModelDetail: false,
      titleModelDetail: "",
      modelDetailForm: {},
      // 研磨派工弹框
       openGroundMolding: false,
      titleGroundMolding: "",
      groundMoldingForm: {},
      // 研磨派工明细弹框
      openGroundMoldingDetail: false,
      titleGroundMoldingDetail: "",
      groundMoldingDetailForm: {},


      activeName: "first",
      activeName1: "first",
      // 花纸派工
      paperFlowerPurchaseList: [
        {
          paperFlowerId: 1,
          purchaseContractNumber: "20210101001",
          purchaseProductionTaskNumber: "20210101001001",
          purchaseProductCode: "123456",
          purchaseMoldNumber: "123456789",
          purchaseColor: "红色",
          purchaseDepartment: "花纸",
          purchasePrincipal: "张三",
          purchaseQuantity: 100,
        },
        {
          paperFlowerId: 2,
          purchaseContractNumber: "20210101002",
          purchaseProductionTaskNumber: "20210101002001",
          purchaseProductCode: "123456",
          purchaseMoldNumber: "123456789",
          purchaseColor: "蓝色",
          purchaseDepartment: "花纸",
          purchasePrincipal:'李四',
          purchaseQuantity: 100,
        },
      ],
      // 花纸派工明细信息
      paperProductionTaskList: [
        {
          paperId: 1,
          paperStartDate: "2022-04-01",
          paperClass: "中班",
          paperPersonNumber: 1000,
          paperWorkDays: 1000,
        },
        {
          paperId: 2,
          paperStartDate: "2021-01-01",
          paperClass: "晚班",
          paperPersonNumber: 10,
          paperWorkDays: 10,
        },
      ],
      // 成型派工
      modelPurchaseList: [
        {
          modelId: 1,
          modelContractNumber: "20210101001",
          modelProductionTaskNumber: "20210101001001",
          modelProductCode: "123456",
          modelMoldNumber: "123456789",
          modelColor: "红色",
          modelDepartment: "成型",
          modelQuantity: 100,
        },
        {
          modelId: 2,
          modelContractNumber: "20210101002",
          modelProductionTaskNumber: "20210101002001",
          modelProductCode: "123456",
          modelMoldNumber: "123456789",
          modelColor: "蓝色",
          modelDepartment: "成型",
          modelQuantity: 100,
        },
      ],
      //  成型派工明细信息
      modelProductionTaskList: [
        {
          modelDetailId: 1,
          modelStartDate: "2021-01-01",
          modelClass: "早班",
          modelPersonNumber: 10,
          modelWorkDays: 10,
        },
        {
          modelDetailId: 2,
          modelStartDate: "2021-01-01",
          modelClass: "晚班",
          modelPersonNumber: 10,
          modelWorkDays: 10,
        },
      ],
      // 研磨派工
      groundMoldingPurchaseList: [
        {
          gorundMoldingId: 1,
          groundMoldingContractNumber: "20210101001",
          groundMoldingProductionTaskNumber: "20210101001001",
          groundMoldingProductCode: "123456",
          groundMoldingMoldNumber: "123456789",
          groundMoldingColor: "红色",
          groundMoldingDepartment: "研磨",
          groundMoldingQuantity: 100,
        },
        {
          gorundMoldingId: 2,
          groundMoldingContractNumber: "20210101002",
          groundMoldingProductionTaskNumber: "20210101002001",
          groundMoldingProductCode: "123456",
          groundMoldingMoldNumber: "123456789",
          groundMoldingColor: "蓝色",
          groundMoldingDepartment: "研磨",
          groundMoldingQuantity: 100,
        },
      ],
      // 研磨派工明细信息
      groundMoldingProductionTaskList: [
        {
          groundMoldingDetailId: 1,
          groundMoldingStartDate: "2021-01-01",
          groundMoldingClass: "早班",
          groundMoldingPersonNumber: 10,
          groundMoldingWorkDays: 10,
        },
        {
          groundMoldingDetailId: 2,
          groundMoldingStartDate: "2021-01-01",
          groundMoldingClass: "晚班",
          groundMoldingPersonNumber: 10,
          groundMoldingWorkDays: 10,
        },
      ],  
      // 弹框
      openFlie: false,
      titleFlie: "",
      // 加载动画
      loading: false,
      // 花纸派工加载
      loadingPaperFlower: false,
      loadingPaperFlowerDetail: false,
      // 成型派工加载
      loadingModel: false,
      loadingModelDetail: false,
      // 研磨派工加载
      loadingGroundMold: false,
      loadingGroundMoldingDetail: false,
      // 显示派工明细信息
      showProductionTask: true,
      showGroundMold: true,
      showModel: true,
      // 分页
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      total: 0,
      // 表单验证规则
      paperFormRules:{},
      // 高亮
      purchaseProductionTaskNumber: "",
      modelContractNumber: "",
      groundMoldingProductionTaskNumber: "",
    };
  },
  methods: {
        // 显示高亮
        rowClassName({ row }) {
          return row.purchaseProductionTaskNumber == this.purchaseProductionTaskNumber ? 'selected-row' : ''; // 判断是否选中
        },
        // 显示高亮
        rowClassNameOne({ row }) {
          return row.modelContractNumber == this.modelContractNumber ? 'selected-row' : ''; // 判断是否选中
        },
        // 显示高亮
        rowClassNameSecond({ row }) {
          return row.groundMoldingProductionTaskNumber == this.groundMoldingProductionTaskNumber ? 'selected-row' : ''; // 判断是否选中
        },
        showTab(row){
          this.groundMoldingProductionTaskNumber = row.groundMoldingProductionTaskNumber;
          this.modelContractNumber = row.modelContractNumber;
          this.purchaseProductionTaskNumber = row.purchaseProductionTaskNumber;
        },
    // 修改花纸派工
    handleUpdatePaperFlower(row) {
      this.titlePaperFlower = "修改花纸派工";
      this.openPaperFlower = true;
      this.paperFlowerForm = row;
    },
    // 修改花纸派工明细
    handleUpdatepaperFlowerDetail(row) {
      this.titlePaper = "修改花纸派工明细";
      this.openPaper = true;
      this.paperForm = row;
    },
    // 修改成型派工
    handleUpdateModel(row) {
      this.titleModel = "修改成型派工";
      this.openModel = true;
      this.modelForm = row;
    },
    // 修改成型派工明细
    handleUpdateModelDetail(row) {
      this.titleModelDetail = "修改成型派工明细";
      this.openModelDetail = true;
      this.modelDetailForm = row;
    },
    // 修改研磨派工
    handleUpdateGroundMolding(row) {
      this.titleGroundMolding = "修改研磨派工";
      this.openGroundMolding = true;
      this.groundMoldingForm = row;
    },
    // 修改研磨派工明细
    handleUpdateGroundMoldDetail(row) {
      this.titleGroundMoldingDetail = "修改研磨派工明细";
      this.openGroundMoldingDetail = true;
      this.groundMoldingDetailForm = row;
    },
    // 新增花纸派工
    handleAddPaperFlower() {
      this.titlePaperFlower = "新增花纸派工";
      this.openPaperFlower = true;
      this.paperFlowerForm = {};
    },
    // 新增花纸派工明细
    handleAddPaperFlowerDetail() {
      this.titlePaper = "新增花纸派工明细";
      this.openPaper = true;
      this.paperForm = {};
    },
    // 新增成型派工
    handleAddModel() {
      this.titleModel = "新增成型派工";
      this.openModel = true;
      this.modelForm = {};
    },
    // 新增成型派工明细
    handleAddModelDetail() {
      this.titleModelDetail = "新增成型派工明细";
      this.openModelDetail = true;
      this.modelDetailForm = {};
    },
    // 新增研磨派工
    handleAddGroundMolding() {
      this.titleGroundMolding = "新增研磨派工";
      this.openGroundMolding = true;
      this.groundMoldingForm = {};
    },
    // 新增研磨派工明细
    handleAddGroundMoldingDetail() {
      this.titleGroundMoldingDetail = "新增研磨派工明细";
      this.openGroundMoldingDetail = true;
      this.groundMoldingDetailForm = {};
    },
    // 花纸派工弹框提交
    handleSubmitPaperFlower() {
      this.$refs["paperFlowerForm"].validate((valid) => {
        if (valid) {
          this.loadingPaperFlower = true;
          if(this.titlePaperFlower == "新增花纸派工"){
             setTimeout(() => {
                this.loadingPaperFlower = false;
                this.$message.success('新增花纸派工成功');
                this.paperFlowerPurchaseList.push(this.paperFlowerForm);
              },1000)
              this.openPaperFlower = false;
          } else if(this.titlePaperFlower == "修改花纸派工"){
             setTimeout(() => {
                this.loadingPaperFlower = false;
                this.$message.success('修改花纸派工成功');
                this.paperFlowerPurchaseList.map((item,index) => {
                  if(item.paperFlowerId == this.paperFlowerForm.paperFlowerId){
                    this.paperFlowerPurchaseList.splice(index,1,this.paperFlowerForm)
                  }
                })
              },1000)
             this.openPaperFlower = false;
          }
        }
      });
    },
    // 花纸派工明细弹框提交
    handleSubmitPaper() {
      this.$refs["paperForm"].validate((valid) => {
        if (valid) {
          this.loadingPaperFlowerDetail = true;
          if(this.titlePaper == "新增花纸派工明细"){
             setTimeout(() => {
                this.loadingPaperFlowerDetail = false;
                this.$message.success('新增花纸派工明细成功');
                this.paperProductionTaskList.push(this.paperForm);
              },1000)
              this.openPaper = false;
          } else if(this.titlePaper == "修改花纸派工明细"){
             setTimeout(() => {
                this.loadingPaperFlowerDetail = false;
                this.$message.success('修改花纸派工明细成功');
                this.paperProductionTaskList.map((item,index) => {
                  if(item.paperId == this.paperForm.paperId){
                    this.paperProductionTaskList.splice(index,1,this.paperForm)
                  }
                })
              },1000)
             this.openPaper = false;
          }
      }
    })
    },
    // 成型派工弹框提交
    handleSubmitModel() {
      this.$refs["modelForm"].validate((valid) => {
        if (valid) {
          this.loadingModel = true;
          if(this.titleModel == "新增成型派工"){
             setTimeout(() => {
                this.loadingModel = false;
                this.$message.success('新增成型派工成功');
                this.modelPurchaseList.push(this.modelForm);
              },1000) 
              this.openModel = false;
          } else if(this.titleModel == "修改成型派工"){
             setTimeout(() => {
                this.loadingModel = false;
                this.$message.success('修改成型派工成功');
                this.modelPurchaseList.map((item,index) => {
                  if(item.modelId == this.modelForm.modelId){
                    this.modelPurchaseList.splice(index,1,this.modelForm)
                  }
                })
              },1000)
             this.openModel = false;
          }
        }
      });
    },
    // 成型派工明细弹框提交
    handleSubmitModelDetail() {
      this.$refs["modelDetailForm"].validate((valid) => {
        if (valid) {
            this.loadingModelDetail = true;
            if(this.titleModelDetail == "新增成型派工明细"){
               setTimeout(() => {
                  this.loadingModelDetail = false;
                  this.$message.success('新增成型派工明细成功');
                  this.modelProductionTaskList.push(this.modelDetailForm);
                },1000)
                this.openModelDetail = false;
            } else if(this.titleModelDetail == "修改成型派工明细"){
               setTimeout(() => {
                  this.loadingModelDetail = false;
                  this.$message.success('修改成型派工明细成功');
                  this.modelProductionTaskList.map((item,index) => {
                    if(item.modelDetailId == this.modelDetailForm.modelDetailId){
                      this.modelProductionTaskList.splice(index,1,this.modelDetailForm)
                    }
                  })
                },1000)
               this.openModelDetail = false;
            }
        }
      });
    },
    // 研磨派工弹框提交
    handleSubmitGroundMolding() {
      this.$refs["groundMoldingForm"].validate((valid) => {
        if (valid) {
          this.loadingGroundMold = true;
          if(this.titleGroundMolding == "新增研磨派工"){
             setTimeout(() => {
                this.loadingGroundMold = false;
                this.$message.success('新增研磨派工成功');
                this.groundMoldingPurchaseList.push(this.groundMoldingForm);
              },1000)
              this.openGroundMolding = false;
          } else if(this.titleGroundMolding == "修改研磨派工"){
             setTimeout(() => {
                this.loadingGroundMold = false;
                this.$message.success('修改研磨派工成功');
                this.groundMoldingPurchaseList.map((item,index) => {
                  if(item.groundMoldingId == this.groundMoldingForm.groundMoldingId){
                    this.groundMoldingPurchaseList.splice(index,1,this.groundMoldingForm)
                  }
                })
             },1000)
             this.openGroundMolding = false;
          }
        }
      });
    },
    // 研磨派工明细弹框提交
    handleSubmitGroundMoldingDetail() {
      this.$refs.groundMoldingDetailForm.validate((valid) => {
        if (valid) {
          this.loadingGroundMoldingDetail = true;
          if(this.titleGroundMoldingDetail == "新增研磨派工明细"){
             setTimeout(() => {
                this.loadingGroundMoldingDetail = false;
                this.$message.success('新增研磨派工明细成功');
                this.groundMoldingProductionTaskList.push(this.groundMoldingDetailForm);
              },1000)
              this.openGroundMoldingDetail = false;
          } else if(this.titleGroundMoldingDetail == "修改研磨派工明细"){
             setTimeout(() => {
                this.loadingGroundMoldingDetail = false;
                this.$message.success('修改研磨派工明细成功');
                this.groundMoldingProductionTaskList.map((item,index) => {
                  if(item.groundMoldingDetailId == this.groundMoldingDetailForm.groundMoldingDetailId){
                    this.groundMoldingProductionTaskList.splice(index,1,this.groundMoldingDetailForm)
                  }
                })
             },1000)
             this.openGroundMoldingDetail = false;
          }
        }
      });
    },
    // 关闭花纸派工弹框
    openPaperFlowerClose() {
      this.openPaperFlower = false;
    },
    // 关闭花纸派工明细弹框
    openPaperClose() {
      this.openPaper = false;
    },
    // 关闭成型派工弹框
    openModelClose() {
      this.openModel = false;
    },
    // 关闭成型派工明细弹框
    openModelDetailClose() {
      this.openModelDetail = false;
    },
    // 关闭研磨派工弹框
    openGroundMoldingClose() {
      this.openGroundMolding = false;
    },
    // 关闭研磨派工明细弹框
    openGroundMoldingDetailClose() {
      this.openGroundMoldingDetail = false;
    },
    
    // 删除花纸派工
    handleDeletePaperFlower(row) {
      this.$confirm("此操作将永久删除该花纸派工, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.$message.success("删除成功!");
          this.paperFlowerPurchaseList.splice(this.paperFlowerPurchaseList.indexOf(row), 1);
        }, 1000);
      }).catch(() => {});
    },
    // 删除花纸派工明细
    handleDeletePaper(row) {
      this.$confirm("此操作将永久删除该花纸派工明细, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.$message.success("删除成功!");
          this.paperProductionTaskList.splice(this.paperProductionTaskList.indexOf(row), 1);
        }, 1000);
      }).catch(() => {});
    },
    // 删除成型派工
    handleDeleteModel(row) {
      this.$confirm("此操作将永久删除该成型派工, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.$message.success("删除成功!");
          this.modelPurchaseList.splice(this.modelPurchaseList.indexOf(row), 1);
        }, 1000);
      }).catch(() => {});
    },
    // 删除成型派工明细
    handleDeleteModelDetail(row) {
      this.$confirm("此操作将永久删除该成型派工明细, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.$message.success("删除成功!");
          this.modelProductionTaskList.splice(this.modelProductionTaskList.indexOf(row), 1);
        }, 1000);
      }).catch(() => {});
    },
    // 删除研磨派工
    handleDeleteGroundMolding(row) {
      this.$confirm("此操作将永久删除该研磨派工, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => { 
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.$message.success("删除成功!");
          this.groundMoldingPurchaseList.splice(this.groundMoldingPurchaseList.indexOf(row), 1);
        }, 1000);
      }).catch(() => {});
    },
    // 删除研磨派工明细
    handleDeleteGroundMoldDetail(row) {
      this.$confirm("此操作将永久删除该研磨派工明细, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.$message.success("删除成功!");
          this.groundMoldingProductionTaskList.splice(this.groundMoldingProductionTaskList.indexOf(row), 1);
        }, 1000);
      }).catch(() => {});
    },
    // 页码改变
    handleCurrentChange(val) {
      this.queryParams.pageNum = val;
      this.getList();
    },
    // 每页显示数量改变
    handleSizeChange(val) {
      this.queryParams.pageSize = val;
      this.getList();
    },
    
  }
}
</script>
<style>
.selected-row {
  background-color: yellow !important;
  /* 选中行的背景颜色 */
}
</style>
